<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="wavenotes.model.presentation.Presentation" %>
<%@ page import="wavenotes.model.presentation.Slide" %>
<%@ page import="wavenotes.model.PMF" %>
<%@page import="com.google.appengine.api.datastore.KeyFactory"%>

<table border="1">
<%
	PersistenceManager pm = PMF.get().getPersistenceManager();
	String query = "select from " + Presentation.class.getName();
	List<Presentation> presentations = (List<Presentation>)pm.newQuery(query).execute();
	
	for (Presentation presentation : presentations) {
%>
		<tr><td><%= presentation.getTitle() %></td><td><%= presentation.getAuthor() %></td><td><%= presentation.getDate() %></td><td><%= presentation.getSlides().size() %></td>
		<td>
<%
		for (Slide slide : presentation.getSlides()) {
%>
			<p>
			<table border="1">
			<tr><td>key: <%= slide.getEncodedKey() %></td></tr>
			<tr><td>notes: <%= slide.getNotes() %></td></tr>
			<tr><td><a href="<%= slide.getSlideUrl() %>"><img src="<%= slide.getSlideUrl() %>"/></a></td></tr>
			</table>
			</p>
<%
		}
%>	  </td></tr>
<%
}
%>
</table>